package design.mode.model.adapter.objectadapter;

import design.mode.model.adapter.SdCard;
import design.mode.model.adapter.TfCard;

/**
 * @description 对象适配器
 * @since jdk11
 */
public class SdToTfAdapter implements SdCard {
    /**
     * 聚合适配者类对象
     */
    private TfCard tfCard;

    public SdToTfAdapter(TfCard tfCard) {
        this.tfCard = tfCard;
    }

    @Override
    public String read() {
        System.out.println("SdToTfAdapter read TF card");
        return tfCard.readTf();
    }

    @Override
    public void write(String message) {
        System.out.println("SdToTfAdapter write TF card");
        tfCard.writeTf(message);
    }
}
